package com.atguigu.democustomer230301.mapper;

import com.atguigu.democustomer230301.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
@DS("demo")
public interface CustomerMapper extends BaseMapper<Customer> {
    @Select("select id,name,age from customer where name=#{name}")
    @DS("demo")
    public Customer selectCustomerByName(@Param("name") String na);

    @Select("${sql}")
    public Map selectCustomerById(@Param("sql") String sql);

    @Insert("insert into customer(id,name,age) values(#{customer.id},#{customer.name},#{customer.age})")
    @DS("test")
    public void insertCustomer(@Param("customer") Customer customer);
}
